package com.usian.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.usian.mapper.TbItemCatmapper;
import com.usian.pojo.TbItemCat;
import com.usian.service.ItemCateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ItemCateServiceImpl implements ItemCateService {
    @Autowired
    TbItemCatmapper tbItemCatmapper;
    // 根据类目 ID 查询当前类目
    @Override
    public List<TbItemCat> selectItemCategoryByParentId(Long id) {
        QueryWrapper<TbItemCat> queryWrapper = new QueryWrapper<TbItemCat>();
        queryWrapper.eq("status",1);
        queryWrapper.eq("parent_id",id);
        List<TbItemCat> list = tbItemCatmapper.selectList(queryWrapper);
        return list;
    }
}
